package cn.brilliantfuture.commentry.entity;

// Generated 2012-7-16 16:25:58 by Hibernate Tools 3.3.0.GA

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * AdvertInfo generated by hbm2java
 */
@Entity
@Table(name = "advert_info", catalog = "cabinet")
public class AdvertInfo implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer advertInfoId;
	private String content;
	private UserGroup userGroup;
	private Date insertTime;
	private int insertUser;
	private boolean deleted;

	private Set<AdvertInfoPubGroup> advertInfoPubGroups = new HashSet<AdvertInfoPubGroup>(0);
	
	public AdvertInfo() {
	}

	public AdvertInfo(Set<AdvertInfoPubGroup> advertInfoPubGroups, String content, UserGroup userGroup, Date insertTime, int insertUser, boolean deleted) {
		this.advertInfoPubGroups = advertInfoPubGroups;
		this.content = content;
		this.userGroup = userGroup;
		this.insertTime = insertTime;
		this.insertUser = insertUser;
		this.deleted = deleted;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "advert_info_id", unique = true, nullable = false)
	public Integer getAdvertInfoId() {
		return this.advertInfoId;
	}

	public void setAdvertInfoId(Integer advertInfoId) {
		this.advertInfoId = advertInfoId;
	}

	@Column(name = "content", nullable = false, length = 200)
	@NotNull
	@Length(max = 200)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "insert_time", nullable = false, length = 19)
	@NotNull
	public Date getInsertTime() {
		return this.insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	@Column(name = "insert_user", nullable = false)
	public int getInsertUser() {
		return this.insertUser;
	}

	public void setInsertUser(int insertUser) {
		this.insertUser = insertUser;
	}

	@Column(name = "deleted", nullable = false)
	public boolean isDeleted() {
		return this.deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "advertInfo")
	public Set<AdvertInfoPubGroup> getAdvertInfoPubGroups() {
		return advertInfoPubGroups;
	}

	public void setAdvertInfoPubGroups(Set<AdvertInfoPubGroup> advertInfoPubGroups) {
		this.advertInfoPubGroups = advertInfoPubGroups;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "group_id", nullable = false)
	@NotNull
	public UserGroup getUserGroup() {
		return userGroup;
	}

	public void setUserGroup(UserGroup userGroup) {
		this.userGroup = userGroup;
	}
}
